<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="120px">
      <el-form-item label=" 上级社区" prop="sssjsq">
        <el-select v-model="queryParams.sssjsq" placeholder="请选择所属上级社区" clearable size="small">
          <el-option
            v-for="dict in sssjsqOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="所属小区" prop="sssq">
        <el-select v-model="queryParams.sssq" placeholder="请选择所属小区" clearable size="small">
          <el-option
            v-for="dict in sssqOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />queryCustomerList
        </el-select>
      </el-form-item>
      <el-form-item label="店铺名称" prop="shopName">
        <el-input
          v-model="queryParams.shopName"
          placeholder="请输入店铺名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="商户门头" prop="shmt">
        <el-input
          v-model="queryParams.shmt"
          placeholder="请输入商户门头"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="注册名" prop="regName">-->
<!--        <el-input-->
<!--          v-model="queryParams.regName"-->
<!--          placeholder="请输入注册名"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="证件号码" prop="zjhm">
        <el-input
          v-model="queryParams.zjhm"
          placeholder="请输入证件号码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="电话号码" prop="phone">
        <el-input
          v-model="queryParams.phone"
          placeholder="请输入电话号码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="地址" prop="address">-->
<!--        <el-input-->
<!--          v-model="queryParams.address"-->
<!--          placeholder="请输入地址"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="机构号" prop="orgId">
        <el-select v-model="queryParams.orgId" placeholder="请选择机构号" clearable size="small">
          <el-option
            v-for="dict in orgIdOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
<!--      <el-form-item label="路段前缀" prop="temp">-->
<!--        <el-input-->
<!--          v-model="queryParams.temp"-->
<!--          placeholder="请输入路段前缀"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="客户经理" prop="userId" >
        <el-select v-model="queryParams.userId" placeholder="请选择客户经理ID" clearable size="small">
          <el-option
            v-for="dict in userIdOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
<!--      <el-form-item label="商户注册名称" prop="shzcmc">-->
<!--        <el-input-->
<!--          v-model="queryParams.shzcmc"-->
<!--          placeholder="请输入商户注册名称"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="经营范围" prop="jyfw">-->
<!--        <el-input-->
<!--          v-model="queryParams.jyfw"-->
<!--          placeholder="请输入经营范围"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="法定代表人" prop="fddbr">
        <el-input
          v-model="queryParams.fddbr"
          placeholder="请输入法定代表人"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="法定代表证件" prop="fddbrzjhm">
        <el-input
          v-model="queryParams.fddbrzjhm"
          placeholder="请输入法定代表证件"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="实际经营人姓名" prop="sjjyr">
        <el-input
          v-model="queryParams.sjjyr"
          placeholder="请输入实际经营人姓名"
          clearable
          size="small"
        />
      </el-form-item>
      <el-form-item label="实际经营人证件" prop="sjjyrzjhm" >
<!--        <el-input   v-model="queryParams.sjjyrzjhm" clearable :style="{width: '100%'}"> </el-input>-->
        <el-input
          v-model="queryParams.sjjyrzjhm"
          placeholder="请输入实际经营人证件"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="客户等级" prop="khdj">-->
<!--        <el-select v-model="queryParams.khdj" placeholder="请选择客户等级" clearable size="small">-->
<!--          <el-option-->
<!--            v-for="dict in khdjOptions"-->
<!--            :key="dict.dictValue"-->
<!--            :label="dict.dictLabel"-->
<!--            :value="dict.dictValue"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="客户群体" prop="group">-->
<!--        <el-select v-model="queryParams.group" placeholder="请选择客户群体" clearable size="small">-->
<!--          <el-option-->
<!--            v-for="dict in groupOptions"-->
<!--            :key="dict.dictValue"-->
<!--            :label="dict.dictLabel"-->
<!--            :value="dict.dictValue"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="客户类型" prop="khlx">-->
<!--        <el-select v-model="queryParams.khlx" placeholder="请选择客户类型" clearable size="small">-->
<!--          <el-option-->
<!--            v-for="dict in khlxOptions"-->
<!--            :key="dict.dictValue"-->
<!--            :label="dict.dictLabel"-->
<!--            :value="dict.dictValue"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
      <el-form-item label="经营状况" prop="jyzk">
        <el-select v-model="queryParams.jyzk" placeholder="请选择经营状况" clearable size="small">
          <el-option
            v-for="dict in jyzkOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
<!--      <el-form-item label="产品标签" prop="cpbq">-->
<!--        <el-select v-model="queryParams.cpbq" placeholder="请选择产品标签" clearable size="small">-->
<!--          <el-option-->
<!--            v-for="dict in cpbqOptions"-->
<!--            :key="dict.dictValue"-->
<!--            :label="dict.dictLabel"-->
<!--            :value="dict.dictValue"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="所属行业" prop="sshy">-->
<!--        <el-select v-model="queryParams.sshy" placeholder="请选择所属行业" clearable size="small">-->
<!--          <el-option-->
<!--            v-for="dict in sshyOptions"-->
<!--            :key="dict.dictValue"-->
<!--            :label="dict.dictLabel"-->
<!--            :value="dict.dictValue"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="是否有效商户 0否  1是" prop="sfyxsh">-->
<!--        <el-select v-model="queryParams.sfyxsh" placeholder="请选择是否有效商户 0否  1是" clearable size="small">-->
<!--          <el-option-->
<!--            v-for="dict in sfyxshOptions"-->
<!--            :key="dict.dictValue"-->
<!--            :label="dict.dictLabel"-->
<!--            :value="dict.dictValue"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="预授信额度" prop="amount">-->
<!--        <el-input-->
<!--          v-model="queryParams.amount"-->
<!--          placeholder="请输入预授信额度"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="是否拓展客户 0否 1是" prop="isExpand">-->
<!--        <el-select v-model="queryParams.isExpand" placeholder="请选择是否拓展客户 0否 1是" clearable size="small">-->
<!--          <el-option-->
<!--            v-for="dict in isExpandOptions"-->
<!--            :key="dict.dictValue"-->
<!--            :label="dict.dictLabel"-->
<!--            :value="dict.dictValue"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="是否有效证件" prop="sfyxzj">-->
<!--        <el-select v-model="queryParams.sfyxzj" placeholder="请选择是否有效证件" clearable size="small">-->
<!--          <el-option-->
<!--            v-for="dict in sfyxzjOptions"-->
<!--            :key="dict.dictValue"-->
<!--            :label="dict.dictLabel"-->
<!--            :value="dict.dictValue"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="备注" prop="remark">-->
<!--        <el-input-->
<!--          v-model="queryParams.remark"-->
<!--          placeholder="请输入备注"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['buss:gridSh:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['buss:gridSh:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['buss:gridSh:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['buss:gridSh:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="gridShList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="ID" align="center" prop="id"  />
      <el-table-column label="所属上级社区" align="center" prop="sssjsq"  />
      <el-table-column label="所属小区" align="center" prop="sssq" />
      <el-table-column label="区域划分" align="center" prop="road"  />
      <el-table-column label="坐标" align="center" prop="coordinate"  />
      <el-table-column label="店铺名称" align="center" prop="shopName" />
      <el-table-column label="注册名" align="center" prop="regName" />
      <el-table-column label="证件号码" align="center" prop="zjhm" />
      <el-table-column label="电话号码" align="center" prop="phone" />
      <el-table-column label="地址" align="center" prop="address"  />
      <el-table-column label="机构" align="center" prop="orgId" :formatter="orgIdFormat" />
      <el-table-column label="路段前缀" align="center" prop="temp" />
      <el-table-column label="路段前缀ID" align="center" prop="tempId" />
      <el-table-column label="经度" align="center" prop="lat" />
      <el-table-column label="纬度" align="center" prop="lng" />
      <el-table-column label="客户经理名称" align="center" prop="userId" :formatter="userIdFormat" />
      <el-table-column label="商户门头" align="center" prop="shmt" />
      <el-table-column label="商户注册名称" align="center" prop="shzcmc"  />
      <el-table-column label="经营范围" align="center" prop="jyfw"  />
      <el-table-column label="经营地址" align="center" prop="jydz"  />
      <el-table-column label="法定代表人" align="center" prop="fddbr" />
      <el-table-column label="法定代表证件" align="center" prop="fddbrzjhm" />
      <el-table-column label="实际经营人姓名" align="center" prop="sjjyr" />
      <el-table-column label="实际经营人证件" align="center" prop="sjjyrzjhm"  />
      <el-table-column label="客户等级" align="center" prop="khdj" />
      <el-table-column label="客户群体" align="center" prop="group"  />
      <el-table-column label="客户类型" align="center" prop="khlx" />
      <el-table-column label="经营状况" align="center" prop="jyzk" />
      <el-table-column label="产品标签" align="center" prop="cpbq" />
      <el-table-column label="所属行业" align="center" prop="sshy" />
      <el-table-column label="是否有效商户" align="center" prop="sfyxsh" :formatter="sfyxshFormat" />
      <el-table-column label="预授信额度" align="center" prop="amount" />
      <el-table-column label="是否拓展客户" align="center" prop="isExpand" :formatter="isExpandFormat" />
      <el-table-column label="是否有效证件" align="center" prop="sfyxzj" :formatter="sfyxzjFormat" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="是否删除" align="center" prop="delFlag" :formatter="delFlagFormat" />
      <el-table-column label="创建人" align="center" prop="createUser" />
      <el-table-column label="修改人" align="center" prop="updateUser" />
      <el-table-column label="创建时间" align="center" prop="updateTime" />
      <el-table-column label="修改时间" align="center" prop="createTime" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['buss:gridSh:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['buss:gridSh:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改网格商户对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="所属上级社区" prop="sssjsq">
          <el-select v-model="form.sssjsq" placeholder="请选择所属上级社区">
            <el-option
              v-for="dict in sssjsqOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="所属小区" prop="sssq">
          <el-select v-model="form.sssq" placeholder="请选择所属小区">
            <el-option
              v-for="dict in sssqOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="店铺名称" prop="shopName">
          <el-input v-model="form.shopName" placeholder="请输入店铺名称" />
        </el-form-item>
        <el-form-item label="注册名" prop="regName">
          <el-input v-model="form.regName" placeholder="请输入注册名" />
        </el-form-item>
        <el-form-item label="证件号码" prop="zjhm">
          <el-input v-model="form.zjhm" placeholder="请输入证件号码" />
        </el-form-item>
        <el-form-item label="电话号码" prop="phone">
          <el-input v-model="form.phone" placeholder="请输入电话号码" />
        </el-form-item>
        <el-form-item label="地址" prop="address">
          <el-input v-model="form.address" placeholder="请输入地址" />
        </el-form-item>
        <el-form-item label="机构号" prop="orgId">
          <el-select v-model="form.orgId" placeholder="请选择机构号">
            <el-option
              v-for="dict in orgIdOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="路段前缀" prop="temp">
          <el-input v-model="form.temp" placeholder="请输入路段前缀" />
        </el-form-item>
        <el-form-item label="客户经理ID" prop="userId">
          <el-select v-model="form.userId" placeholder="请选择客户经理ID">
            <el-option
              v-for="dict in userIdOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="商户注册名称" prop="shzcmc">
          <el-input v-model="form.shzcmc" placeholder="请输入商户注册名称" />
        </el-form-item>
        <el-form-item label="经营范围" prop="jyfw">
          <el-input v-model="form.jyfw" placeholder="请输入经营范围" />
        </el-form-item>
        <el-form-item label="法定代表人" prop="fddbr">
          <el-input v-model="form.fddbr" placeholder="请输入法定代表人" />
        </el-form-item>
        <el-form-item label="法定代表证件" prop="fddbrzjhm">
          <el-input v-model="form.fddbrzjhm" placeholder="请输入法定代表证件" />
        </el-form-item>
        <el-form-item label="实际经营人姓名" prop="sjjyr">
          <el-input v-model="form.sjjyr" placeholder="请输入实际经营人姓名" />
        </el-form-item>
        <el-form-item label="实际经营人证件" prop="sjjyrzjhm">
          <el-input v-model="form.sjjyrzjhm" placeholder="请输入实际经营人证件" />
        </el-form-item>
        <el-form-item label="客户等级" prop="khdj">
          <el-select v-model="form.khdj" placeholder="请选择客户等级">
            <el-option
              v-for="dict in khdjOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="客户群体" prop="group">
          <el-select v-model="form.group" placeholder="请选择客户群体">
            <el-option
              v-for="dict in groupOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="客户类型" prop="khlx">
          <el-select v-model="form.khlx" placeholder="请选择客户类型">
            <el-option
              v-for="dict in khlxOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="经营状况" prop="jyzk">
          <el-select v-model="form.jyzk" placeholder="请选择经营状况">
            <el-option
              v-for="dict in jyzkOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="产品标签" prop="cpbq">
          <el-select v-model="form.cpbq" placeholder="请选择产品标签">
            <el-option
              v-for="dict in cpbqOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="所属行业" prop="sshy">
          <el-select v-model="form.sshy" placeholder="请选择所属行业">
            <el-option
              v-for="dict in sshyOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否有效商户 0否  1是" prop="sfyxsh">
          <el-select v-model="form.sfyxsh" placeholder="请选择是否有效商户 0否  1是">
            <el-option
              v-for="dict in sfyxshOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="预授信额度" prop="amount">
          <el-input v-model="form.amount" placeholder="请输入预授信额度" />
        </el-form-item>
        <el-form-item label="是否拓展客户 0否 1是" prop="isExpand">
          <el-select v-model="form.isExpand" placeholder="请选择是否拓展客户 0否 1是">
            <el-option
              v-for="dict in isExpandOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否有效证件" prop="sfyxzj">
          <el-select v-model="form.sfyxzj" placeholder="请选择是否有效证件">
            <el-option
              v-for="dict in sfyxzjOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listGridSh, getGridSh, delGridSh, addGridSh, updateGridSh } from "@/api/buss/gridSh";

export default {
  name: "GridSh",
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 网格商户表格数据
      gridShList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,



      // 机构号字典
      orgIdOptions: [],

      // 客户经理ID字典
      userIdOptions: [],


      // 是否有效商户 0否  1是字典
      sfyxshOptions: [],

      // 是否拓展客户 0否 1是字典
      isExpandOptions: [],
      // 是否有效证件字典
      sfyxzjOptions: [],

      // 是否删除字典
      delFlagOptions: [],

      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        id: null,
        sssjsq: null,
        sssq: null,
        road: null,
        coordinate: null,
        shopName: null,
        regName: null,
        zjhm: null,
        phone: null,
        managerName: null,
        address: null,
        orgId: null,
        temp: null,
        tempId: null,
        lat: null,
        lng: null,
        userId: null,
        shmt: null,
        shzcmc: null,
        jyfw: null,
        jydz: null,
        fddbr: null,
        fddbrzjhm: null,
        sjjyr: null,
        sjjyrzjhm: null,
        khdj: null,
        group: null,
        khlx: null,
        jyzk: null,
        cpbq: null,
        sshy: null,
        sfyxsh: null,
        amount: null,
        isExpand: null,
        sfyxzj: null,
        remark: null,
        delFlag: null,
        createUser: null,
        updateUser: null,
        updateTime: null,
        createTime: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
    this.getDicts("sys_org_id").then(response => {
      this.orgIdOptions = response.data;
    });
    this.getDicts("sys_user_id").then(response => {
      this.userIdOptions = response.data;
    });
    this.getDicts("if_yes_no").then(response => {
      this.sfyxshOptions = response.data;
    });
    this.getDicts("if_yes_no").then(response => {
      this.isExpandOptions = response.data;
    });
    this.getDicts("if_yes_no").then(response => {
      this.sfyxzjOptions = response.data;
    });
    this.getDicts("if_yes_no").then(response => {
      this.delFlagOptions = response.data;
    });
  },
  methods: {
    /** 查询网格商户列表 */
    getList() {
      this.loading = true;
      listGridSh(this.queryParams).then(response => {
        this.gridShList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 修改时间字典翻译
    idFormat(row, column) {
      return this.selectDictLabel(this.idOptions, row.id);
    },
    // 所属上级社区字典翻译
    sssjsqFormat(row, column) {
      return this.selectDictLabel(this.sssjsqOptions, row.sssjsq);
    },
    // 所属小区字典翻译
    sssqFormat(row, column) {
      return this.selectDictLabel(this.sssqOptions, row.sssq);
    },
    // 1区域划分匹配上2手动划分指定客户经理 5手动导入坐标未匹配客户经理 3手动导入坐标后并匹配客户经理字典翻译
    roadFormat(row, column) {
      return this.selectDictLabel(this.roadOptions, row.road);
    },
    // 坐标字典翻译
    coordinateFormat(row, column) {
      return this.selectDictLabel(this.coordinateOptions, row.coordinate);
    },
    // 店铺名称字典翻译
    shopNameFormat(row, column) {
      return this.selectDictLabel(this.shopNameOptions, row.shopName);
    },
    // 注册名字典翻译
    regNameFormat(row, column) {
      return this.selectDictLabel(this.regNameOptions, row.regName);
    },
    // 证件号码字典翻译
    zjhmFormat(row, column) {
      return this.selectDictLabel(this.zjhmOptions, row.zjhm);
    },
    // 电话号码字典翻译
    phoneFormat(row, column) {
      return this.selectDictLabel(this.phoneOptions, row.phone);
    },
    // 客户经理名称字典翻译
    managerNameFormat(row, column) {
      return this.selectDictLabel(this.managerNameOptions, row.managerName);
    },
    // 地址字典翻译
    addressFormat(row, column) {
      return this.selectDictLabel(this.addressOptions, row.address);
    },
    // 机构号字典翻译
    orgIdFormat(row, column) {
      return this.selectDictLabel(this.orgIdOptions, row.orgId);
    },
    // 路段前缀字典翻译
    tempFormat(row, column) {
      return this.selectDictLabel(this.tempOptions, row.temp);
    },
    // 路段前缀ID字典翻译
    tempIdFormat(row, column) {
      return this.selectDictLabel(this.tempIdOptions, row.tempId);
    },
    // 经度字典翻译
    latFormat(row, column) {
      return this.selectDictLabel(this.latOptions, row.lat);
    },
    // 纬度字典翻译
    lngFormat(row, column) {
      return this.selectDictLabel(this.lngOptions, row.lng);
    },
    // 客户经理ID字典翻译
    userIdFormat(row, column) {
      return this.selectDictLabel(this.userIdOptions, row.userId);
    },
    // 商户门口字典翻译
    shmtFormat(row, column) {
      return this.selectDictLabel(this.shmtOptions, row.shmt);
    },
    // 商户注册名称字典翻译
    shzcmcFormat(row, column) {
      return this.selectDictLabel(this.shzcmcOptions, row.shzcmc);
    },
    // 经营范围字典翻译
    jyfwFormat(row, column) {
      return this.selectDictLabel(this.jyfwOptions, row.jyfw);
    },
    // 经营地址字典翻译
    jydzFormat(row, column) {
      return this.selectDictLabel(this.jydzOptions, row.jydz);
    },
    // 法定代表人字典翻译
    fddbrFormat(row, column) {
      return this.selectDictLabel(this.fddbrOptions, row.fddbr);
    },
    // 法定代表证件字典翻译
    fddbrzjhmFormat(row, column) {
      return this.selectDictLabel(this.fddbrzjhmOptions, row.fddbrzjhm);
    },
    // 实际经营人姓名字典翻译
    sjjyrFormat(row, column) {
      return this.selectDictLabel(this.sjjyrOptions, row.sjjyr);
    },
    // 实际经营人证件字典翻译
    sjjyrzjhmFormat(row, column) {
      return this.selectDictLabel(this.sjjyrzjhmOptions, row.sjjyrzjhm);
    },
    // 客户等级字典翻译
    khdjFormat(row, column) {
      return this.selectDictLabel(this.khdjOptions, row.khdj);
    },
    // 客户群体字典翻译
    groupFormat(row, column) {
      return this.selectDictLabel(this.groupOptions, row.group);
    },
    // 客户类型字典翻译
    khlxFormat(row, column) {
      return this.selectDictLabel(this.khlxOptions, row.khlx);
    },
    // 经营状况字典翻译
    jyzkFormat(row, column) {
      return this.selectDictLabel(this.jyzkOptions, row.jyzk);
    },
    // 产品标签字典翻译
    cpbqFormat(row, column) {
      return this.selectDictLabel(this.cpbqOptions, row.cpbq);
    },
    // 所属行业字典翻译
    sshyFormat(row, column) {
      return this.selectDictLabel(this.sshyOptions, row.sshy);
    },
    // 是否有效商户 0否  1是字典翻译
    sfyxshFormat(row, column) {
      return this.selectDictLabel(this.sfyxshOptions, row.sfyxsh);
    },
    // 预授信额度字典翻译
    amountFormat(row, column) {
      return this.selectDictLabel(this.amountOptions, row.amount);
    },
    // 是否拓展客户 0否 1是字典翻译
    isExpandFormat(row, column) {
      return this.selectDictLabel(this.isExpandOptions, row.isExpand);
    },
    // 是否有效证件字典翻译
    sfyxzjFormat(row, column) {
      return this.selectDictLabel(this.sfyxzjOptions, row.sfyxzj);
    },
    // 备注字典翻译
    remarkFormat(row, column) {
      return this.selectDictLabel(this.remarkOptions, row.remark);
    },
    // 是否删除字典翻译
    delFlagFormat(row, column) {
      return this.selectDictLabel(this.delFlagOptions, row.delFlag);
    },
    // 创建人字典翻译
    createUserFormat(row, column) {
      return this.selectDictLabel(this.createUserOptions, row.createUser);
    },
    // 修改人字典翻译
    updateUserFormat(row, column) {
      return this.selectDictLabel(this.updateUserOptions, row.updateUser);
    },
    // 创建时间字典翻译
    updateTimeFormat(row, column) {
      return this.selectDictLabel(this.updateTimeOptions, row.updateTime);
    },
    // 修改时间字典翻译
    createTimeFormat(row, column) {
      return this.selectDictLabel(this.createTimeOptions, row.createTime);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        sssjsq: null,
        sssq: null,
        road: null,
        coordinate: null,
        shopName: null,
        regName: null,
        zjhm: null,
        phone: null,
        managerName: null,
        address: null,
        orgId: null,
        temp: null,
        tempId: null,
        lat: null,
        lng: null,
        userId: null,
        shmt: null,
        shzcmc: null,
        jyfw: null,
        jydz: null,
        fddbr: null,
        fddbrzjhm: null,
        sjjyr: null,
        sjjyrzjhm: null,
        khdj: null,
        group: null,
        khlx: null,
        jyzk: null,
        cpbq: null,
        sshy: null,
        sfyxsh: null,
        amount: null,
        isExpand: null,
        sfyxzj: null,
        remark: null,
        delFlag: null,
        createUser: null,
        updateUser: null,
        updateTime: null,
        createTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加网格商户";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getGridSh(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改网格商户";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateGridSh(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addGridSh(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除网格商户编号为"' + ids + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function() {
        return delGridSh(ids);
      }).then(() => {
        this.getList();
        this.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('buss/gridSh/export', {
        ...this.queryParams
      }, `buss_gridSh.xlsx`)
    }
  }
};
</script>
